<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改UCA-配置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-conf-edit" th:object="${ucaConf}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">验证项：</label>
                <div class="col-sm-8" th:with="type=${@dict.getType('check_type')}">
                    <label th:each="dict : ${type}" class="check-box">
                        <input name="checkType" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" th:attr="checked=${ucaConf.checkType.contains(dict.dictValue)?true:false}">
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">用户名：</label>
                <div class="col-sm-8">
                    <input name="sourceName" th:field="*{tUser}" class="form-control" type="text" maxlength="20">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">区分号：</label>
                <div class="col-sm-8">
                    <input name="sourceName" th:field="*{tCorporation}" class="form-control" type="text" maxlength="3">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">系统名称：</label>
                <div class="col-sm-8">
                    <input name="sourceName" th:field="*{sourceName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">URL：</label>
                <div class="col-sm-8">
                    <input name="source" th:field="*{source}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">系统标识：</label>
                <div class="col-sm-8">
                    <input name="sourceFlag" th:field="*{sourceFlag}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">目标系统URL：</label>
                <div class="col-sm-8">
                    <input name="target" th:field="*{target}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
               <div class="col-sm-8">
                   <label class="toggle-switch switch-solid">
                        <input type="checkbox" id="status" th:checked="*{status == '0' ? true: false}">
                        <span></span>
                    </label>
               </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">目标系统名称：</label>
                <div class="col-sm-8">
                    <input name="targetName" th:field="*{targetName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "conf/conf";
        $("#form-conf-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	var data = $("#form-conf-edit").serializeArray();
            	var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
            	data.push({"name": "status", "value": status});
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</body>
</html>